home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / MouseInfo / UMouseDocument.cp < prev    next >
Encoding:
Text File  |  1995-02-04  |  1.7 KB  |  75 lines  |  [TEXT/MPS ]

  1. //     UMouseDocument.cp 
  2. //     Copyright © 1992 by Apple Computer, Inc. All rights reserved.
  3. //    Kent Sandvik DTS
  4. //    This file contains the basic TMouseDocument member functions
  5. //    Version Info (latest first):
  6. //
  7. //    <1>        khs        1.0        First final version
  8. //    <2>        khs        1.0.1    Fixed a memory leak in TMapApplication::GetSleepValue()
  9.  
  10.  
  11. // INCLUDES
  12. #ifndef __UMOUSEDOCUMENT__
  13. #include "UMouseDocument.h"                                    // class definitions
  14. #endif
  15.  
  16. #undef Inherited
  17. #define Inherited TDocument
  18.  
  19. #pragma segment AInit
  20. DefineClass(TMouseDocument, Inherited);
  21.  
  22. //    CLASS METHODS 
  23. //    Empty constructor - for avoiding ptabs in global data space
  24. TMouseDocument::TMouseDocument()
  25. {
  26. }
  27.  
  28.  
  29. //    Create TMouseDocument
  30. #pragma segment AInit
  31.      void TMouseDocument::IMouseDocument()
  32. {
  33.     Inherited::IDocument();
  34. }
  35.  
  36.  
  37. //    Free any resources attached to the TMouseDocument - yes it's empty, but one never
  38. //    knows if one could place something here, so I have it added. Yes, it wastes CPU
  39. //    cycles...
  40. #pragma segment AClose
  41.      void TMouseDocument::Free()
  42. {
  43.     Inherited::Free();
  44. }
  45.  
  46.  
  47. //    Create any needed TMouseDocument Views
  48. #pragma segment AOpen
  49.      void TMouseDocument::DoMakeViews(Boolean    /*forPrinting*/)
  50. {
  51.     TWindow * aWindow = NULL;
  52.     FailInfo fi;
  53.  
  54.     Try(fi)
  55.     {
  56.         // create main information window    
  57.         aWindow = (TWindow *)gViewServer->NewTemplateWindow(kMainWindow, this);
  58.         fMainView = (TView *)aWindow->FindSubView('vie1');
  59.  
  60.         // add frame adorner for the document
  61.         fMainView->AddAdorner(NewStdAdorner('afra', "", 'afra', kFreeOnDeletion), kDrawView, kRedraw);
  62.  
  63.         //    add mouse tracking behaviors
  64.         TMouseTrackBehavior * theBehavior = new TMouseTrackBehavior;
  65.         theBehavior->IMouseTrackBehavior(mMouseTrack);
  66.         this->AddBehavior(theBehavior);
  67.  
  68.         fi.Success();
  69.     }
  70.     else
  71.         fi.ReSignal();
  72. }
  73.  
  74.  
  75.